clear-patches

 

Clear-patches is a command that clears the patches by resetting all patch variables to their default initial values, including setting their color to black. It is usually located in a command procedure. The shorthand version of this command is cp.

Clear-turtles is a command that removes all the turtles as well as resets the numbering of turtles. It is usually located in a command procedure. The shorthand version of this command is ct. See die for more about removing turtles from a plot.

These are only used when we do not want to use clear-all. For example, if we wanna clear the patches but keep some global variables’ values & the position of the turtles, you would use clear-patches. If we wanna clear the turtles but keep the patches and their initial values, you would use clear-turtles.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the clear-patches primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Similar primitives:
clear-all

clears all the drawings, turtles, plots, etc., leaving a blank slate.

Read more
clear-turtles

removes all the turtles as well as resets the numbering of turtles

Read more
neighbors

reports an agentset containing eight neighboring patches

Read more
pcolor

built-in patch variable that holds the color of the patch

Read more
 
Learn another primitive